const { Tab } = require('../../assets/libs/zanui/index');

var app = getApp();
Page(Object.assign({}, Tab, {
  data: {
		clientStartSetting:{
		  'clientStartDuration': "",
		  'clientStartImage': "",
			'clientIsStart': true,
		},
		cdnUrl: '',
    bannerList: [],
    archivesList: [],
    loading: false,
    nodata: false,
    nomore: false,
    tab: {
      list: [],
      selectedId: '0',
      scroll: true,
      height: 44
    },
	
		/* 自定义导航栏参数 */
		loading: false,
		color: '#FFFFFF',
		background: '#FFFFFF',
		show: true,
		animated: false,
		back: false,
		title: "",
		
		/* 自定义tabbar */
		list: [
			{
			    "pagePath": "/page/index/index",
			    "iconPath": "/assets/images/tabbar/index.png",
			    "selectedIconPath": "/assets/images/tabbar/index-hl.png",
			    "text": "首页"
			},
			
			{
			    "pagePath": "/page/discover/index",
			    "iconPath": "/assets/images/tabbar/addon.png",
			    "selectedIconPath": "/assets/images/tabbar/addon-hl.png",
			    "text": "发现"
			},
			{
			    "pagePath": "/page/my/index",
			    "iconPath": "/assets/images/tabbar/my.png",
			    "selectedIconPath": "/assets/images/tabbar/my-hl.png",
			    "text": "我的"
			}
		],
		currentTab: 0,
	  
  },
  onLoad: function () {
    var that = this;
		that.setData({
			cdnUrl: app.cdnUrl,
      height: app.globalData.windowHeight*2,
      width: app.globalData.windowWidth*2,
		});
    app.request('/addons/cms/wxapp.index/index', {}, function (data, ret) {
      that.setData({
				clientStartSetting: data.clientStartSetting
      });
			if( data.clientStartSetting.clientIsStart==true ){
				setTimeout(function() {
					wx.switchTab({
						url:"/page/index/index"
					});
				}, data.clientStartSetting.clientStartDuration);
			}else{
        wx.switchTab({
        	url:"/page/index/index"
        });
      }
    }, function (data, ret) {
      app.error(ret.msg);
    });
  },
  onShareAppMessage: function () {
    return {
      title: '',
      desc: '',
      path: '/page/index/index'
    };
  }
}));
